package vip.xiaonuo.smzq.modular.hisi.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.hisi.entity.HisiClbData;
import vip.xiaonuo.smzq.modular.hisi.service.IHisiClbDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 储量数据表
 *
 * @author eomer
 * @since 2024-02-22
 */
@Api(tags = "储量数据表")
@RestController
@RequestMapping("/hisi/hisiClbData")
@Validated
public class HisiClbDataController {

    @Resource
    private IHisiClbDataService iHisiClbDataService;

    /**
     * 添加储量数据表
     */
    @ApiOperation("添加储量数据表")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid HisiClbData hisiClbData) {
        iHisiClbDataService.save(hisiClbData);
        return CommonResult.ok();
    }

    /**
     * 删除储量数据表
     */
    @ApiOperation("删除储量数据表")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iHisiClbDataService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑储量数据表
     */
    @ApiOperation("编辑储量数据表")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid HisiClbData hisiClbData) {
        iHisiClbDataService.updateById(hisiClbData);
        return CommonResult.ok();
    }

    /**
     * 储量数据表分页查询
     */
    @ApiOperation("储量数据表分页查询")
    @GetMapping("/list")
    public CommonResult<Page<HisiClbData>> page() {
        return CommonResult.data(iHisiClbDataService.page(new HisiClbData()));
    }
}
